<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>libdill</title>
  <link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>

<h1>libdill: Structured Concurrency for C</h1>

<ul id='toplist'>
<li><a href="index.html">Home</a></li>
<li><a href="download.html">Download</a></li>
<li><a href="documentation.html">Documentation</a></li>
<li><a href="tutorial.html">Tutorials</a></li>
<li><a href="faq.html">FAQ</a></li>
</ul>
<h1 id="name">NAME</h1>
<p>fdclean - erases cached info about a file descriptor</p>
<h1 id="synopsis">SYNOPSIS</h1>
<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c"><span class="pp">#include </span><span class="im">&lt;libdill.h&gt;</span>

<span class="dt">void</span> fdclean(
    <span class="dt">int</span> fd);</code></pre></div>
<h1 id="description">DESCRIPTION</h1>
<p>This function drops any state that libdill associates with a file descriptor. It has to be called before the file descriptor is closed. If it is not, the behavior is undefined.</p>
<p>It should also be used whenever you are losing control of the file descriptor. For example, when passing it to a third-party library. Also, if you are handed the file descriptor by third party code you should call this function just before returning it back to the original owner.</p>
<p><strong>fd</strong>: file descriptor (OS-level one, not a libdill handle)</p>
<h1 id="return-value">RETURN VALUE</h1>
<p>None.</p>
<h1 id="errors">ERRORS</h1>
<p>None.</p>
<h1 id="example">EXAMPLE</h1>
<div class="sourceCode"><pre class="sourceCode c"><code class="sourceCode c"><span class="dt">int</span> fds[<span class="dv">2</span>];
pipe(fds);
use_the_pipe(fds);
fdclean(fds[<span class="dv">0</span>]);
close(fds[<span class="dv">0</span>]);
fdclean(fds[<span class="dv">1</span>]);
close(fds[<span class="dv">1</span>]);</code></pre></div>
<h1 id="see-also">SEE ALSO</h1>
<p><strong>fdin</strong>(3) <strong>fdout</strong>(3)</p>
</body>
